import {createBrowserRouter} from 'react-router-dom';
import { lazy,Suspense } from 'react';
import RouterPlug from '@/components/RouterPlug';
const Login = lazy(()=>import('@/pages/login'));
const Home = lazy(()=>import('@/App'));
const Text = lazy(()=>import('@/pages/text'));
const Text1 = lazy(()=>import('@/pages/text1'));
const Text2 = lazy(()=>import('@/pages/text2'));
const Text3 = lazy(()=>import('@/pages/text3'));
const Text4 = lazy(()=>import('@/pages/text4'));
const Pixi = lazy(()=>import('@/pages/pixinjs'));

const router = createBrowserRouter([
    {
        path:'/',
        element:<RouterPlug>
            <Suspense fallback={'加载中'}><Home /></Suspense>
        </RouterPlug>
    },
    {
        path:'/login',
        element:<Suspense fallback={'加载中'}>
            <Login />
        </Suspense>
    },
    {
        path:'/text',
        element:<RouterPlug>
            <Suspense fallback={'加载中'}><Text /></Suspense>
        </RouterPlug>
    },
    {
        path:'/text1',
        element:<RouterPlug>
            <Suspense fallback={'加载中'}><Text1 /></Suspense>
        </RouterPlug>
    },
    {
        path:'/text2',
        element:<RouterPlug>
            <Suspense fallback={'加载中'}><Text2 /></Suspense>
        </RouterPlug>
    },{
        path:'/text3',
        element:<RouterPlug>
            <Suspense fallback={'加载中'}><Text3 /></Suspense>
        </RouterPlug>
    },{
        path:'/text4',
        element:<RouterPlug>
            <Suspense fallback={'加载中'}><Text4 /></Suspense>
        </RouterPlug>
    },{
        path:'/pixi',
        element:<RouterPlug>
            <Suspense fallback={'加载中'}><Pixi /></Suspense>
        </RouterPlug>
    },{
        path:'*',
        element:<div>404</div>
    }

])
export default router;